home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume17 / ease2 / part01 next >
Encoding:
Internet Message Format  |  1989-02-08  |  53.4 KB

  1. Subject:  v17i087:  Ease2.0, a language for sendmail.cf files, Part01/03
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: "Arnold D. Robbins" <arnold@EMORYU1.ARPA>
  6. Posting-number: Volume 17, Issue 87
  7. Archive-name: ease2/part01
  8.  
  9. This is a fresh posting of the entire source for 'ease', the language
  10. for writing sendmail(8) configuration files. It incorporates all the
  11. enhancements in my December posting of diffs, plus some bug fixes,
  12. and support for undocumented/unimplemented sendmail features. I have
  13. also included, my 'cfc' program, which turns raw sendmail files into
  14. something close to real 'ease'. All changes and improvements are actually
  15. documented in the documentation.
  16.  
  17. Besides my own contributions, this posting includes code from Stephen Schaefer
  18. of Bowling Green State University, Jeff Stearns of John Fluke Manufacturing
  19. Company, Raymond Schnitzler of Bellcore, and Andrew Partan of the Corporation
  20. for Open systems. Based on suggestions from Rich Salz of BBN, I have reworked
  21. the lexical analyzer to use a binary search on a table of keywords. This makes
  22. the program much smaller, and also slightly faster.
  23.  
  24. I have retired the 'maketd' program for making dependencies, and replaced
  25. it with the standard BSD Makefile method. I have also removed the config
  26. files from the original posting, since they were never completed.
  27.  
  28. More or less by default, I have become the "official" maintainer of ease.
  29. However, I think at this point it does all it needs to do; I don't intend
  30. to devote lots of work to it. However, if you find (and fix) bugs, I would
  31. be interested in seeing what you do.
  32.  
  33. Enjoy,
  34.  
  35. Arnold Robbins
  36. Unix Systems Programmer
  37. Emory University Computing Center
  38.  
  39. #! /bin/sh
  40. # This is a shell archive.  Remove anything before this line, then unpack
  41. # it by saving it into a file and typing "sh file".  To overwrite existing
  42. # files, type "sh file -c".  You can also feed this as standard input via
  43. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  44. # will see the following message at the end:
  45. #        "End of archive 1 (of 3)."
  46. # Contents:  MANIFEST README cfc cfc/cfc.1 doc doc/Makefile doc/ap1
  47. #   doc/ap2 doc/ap3 doc/ap4 doc/cover local local/Makefile
  48. #   local/ease.1 local/ease.ksh local/ease.sh src src/Makefile
  49. #   src/errors.c src/fixstrings.c src/fixstrings.h src/idman.c
  50. #   src/main.c src/symtab.c src/symtab.h
  51. # Wrapped by rsalz@papaya.bbn.com on Wed Feb  8 16:55:42 1989
  52. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  53. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  54.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  55. else
  56. echo shar: Extracting \"'MANIFEST'\" \(1057 characters\)
  57. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  58. X   File Name        Archive #    Description
  59. X-----------------------------------------------------------
  60. X MANIFEST                   1    
  61. X README                     1    
  62. X cfc                        1    
  63. X cfc/cfc.1                  1    
  64. X cfc/cfc.c                  3    
  65. X doc                        1    
  66. X doc/Makefile               1    
  67. X doc/ap1                    1    
  68. X doc/ap2                    1    
  69. X doc/ap3                    1    
  70. X doc/ap4                    1    
  71. X doc/cover                  1    
  72. X doc/ease.paper             3    
  73. X local                      1    
  74. X local/Makefile             1    
  75. X local/ease.1               1    
  76. X local/ease.ksh             1    
  77. X local/ease.sh              1    
  78. X src                        1    
  79. X src/Makefile               1    
  80. X src/emitcf.c               2    
  81. X src/errors.c               1    
  82. X src/fixstrings.c           1    
  83. X src/fixstrings.h           1    
  84. X src/idman.c                1    
  85. X src/lexan.l                2    
  86. X src/main.c                 1    
  87. X src/parser.y               2    
  88. X src/strops.c               2    
  89. X src/symtab.c               1    
  90. X src/symtab.h               1    
  91. END_OF_FILE
  92. if test 1057 -ne `wc -c <'MANIFEST'`; then
  93.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  94. fi
  95. # end of 'MANIFEST'
  96. fi
  97. if test -f 'README' -a "${1}" != "-c" ; then 
  98.   echo shar: Will not clobber existing file \"'README'\"
  99. else
  100. echo shar: Extracting \"'README'\" \(1616 characters\)
  101. sed "s/^X//" >'README' <<'END_OF_FILE'
  102. XREADME - Wed Jun 15 14:52:41 EDT 1988
  103. X
  104. XThis is a fresh posting of the entire source for 'ease', the language
  105. Xfor writing sendmail(8) configuration files. It incorporates all the
  106. Xenhancements in my December posting of diffs, plus some bug fixes,
  107. Xand support for undocumented/unimplemented sendmail features. I have
  108. Xalso included, my 'cfc' program, which turns raw sendmail files into
  109. Xsomething close to real 'ease'. All changes and improvements are actually
  110. Xdocumented in the documentation.
  111. X
  112. XBesides my own contributions, this posting includes code from Stephen Schaefer
  113. Xof Bowling Green State University, Jeff Stearns of John Fluke Manufacturing
  114. XCompany, Raymond Schnitzler of Bellcore, and Andrew Partan of the Corporation
  115. Xfor Open systems. Based on suggestions from Rich Salz of BBN, I have reworked
  116. Xthe lexical analyzer to use a binary search on a table of keywords. This makes
  117. Xthe program much smaller, and also slightly faster.
  118. X
  119. XI have retired the 'maketd' program for making dependencies, and replaced
  120. Xit with the standard BSD Makefile method. I have also removed the config
  121. Xfiles from the original posting, since they were never completed.
  122. X
  123. XMore or less by default, I have become the "official" maintainer of ease.
  124. XHowever, I think at this point it does all it needs to do; I don't intend
  125. Xto devote lots of work to it. However, if you find (and fix) bugs, I would
  126. Xbe interested in seeing what you do.
  127. X
  128. XEnjoy,
  129. X
  130. XArnold Robbins
  131. XUnix Systems Programmer
  132. XEmory University Computing Center
  133. XUUCP:        gatech!emoryu1!arnold
  134. XBITNET:        arnold@emoryu1.BITNET
  135. XInternet:    arnold@emoryu1.ARPA    (current)
  136. X        arnold@emory.edu    (soon)
  137. END_OF_FILE
  138. if test 1616 -ne `wc -c <'README'`; then
  139.     echo shar: \"'README'\" unpacked with wrong size!
  140. fi
  141. chmod +x 'README'
  142. # end of 'README'
  143. fi
  144. if test ! -d 'cfc' ; then
  145.     echo shar: Creating directory \"'cfc'\"
  146.     mkdir 'cfc'
  147. fi
  148. if test -f 'cfc/cfc.1' -a "${1}" != "-c" ; then 
  149.   echo shar: Will not clobber existing file \"'cfc/cfc.1'\"
  150. else
  151. echo shar: Extracting \"'cfc/cfc.1'\" \(3571 characters\)
  152. sed "s/^X//" >'cfc/cfc.1' <<'END_OF_FILE'
  153. X...
  154. X... $Header: cfc.1,v 2.0 88/06/15 15:17:36 arnold Exp $
  155. X... 
  156. X... $Log:    cfc.1,v $
  157. X... Revision 2.0  88/06/15  15:17:36  arnold
  158. X... Baseline release for net posting. ADR.
  159. X... 
  160. X... Revision 1.3  88/01/21  16:23:21  arnold
  161. X... Some typo fixes.
  162. X... 
  163. X... Revision 1.2  87/04/08  10:21:47  arnold
  164. X... Small bug fixes, compatibility option added, also warnings for
  165. X... unrecognized flags and options. ADR.
  166. X... 
  167. X... Revision 1.1  87/02/16  15:25:32  arnold
  168. X... Initial revision
  169. X... 
  170. X...
  171. X.TH CFC 8 local
  172. X.SH NAME
  173. Xcfc \- Sendmail cf file compiler
  174. X.SH SYNOPSIS
  175. X.B cfc
  176. X[
  177. X.B \-c
  178. X] [
  179. X.B \-u
  180. X] <
  181. X.I sendmail.cf-file
  182. X>
  183. X.I ease-source-file
  184. X.SH DESCRIPTION
  185. X.I Cfc
  186. Xis a filter that reads a raw
  187. X.IR sendmail (8)
  188. Xconfiguration file on its standard input, and produces almost useable
  189. X.IR ease (1)
  190. Xsource on its standard output.
  191. X.P
  192. XIt is designed as a conversion tool, to translate an existing
  193. X.B sendmail.cf
  194. Xfile into
  195. X.I ease
  196. Xwith the idea that all future work will be done in
  197. X.IR ease .
  198. X.P
  199. X.I Cfc
  200. Xpasses all comments through to the output, and converts all predefined
  201. X.I sendmail
  202. Xmacros, options, option values, and mailer flags into the names used by
  203. X.IR ease .
  204. X.P
  205. XOnce it is through, the user need only spend some time in a good screen
  206. Xeditor doing the following:
  207. X.RS
  208. X.P
  209. XChanging the RULESET_n names into more descriptive names, and
  210. Xadding ruleset bindings.
  211. X.P
  212. XApplying quoting to necessary string literals, principally in the
  213. Xdefinitions of headers. The
  214. X.I ease
  215. Xdocumentation on header formats should be consulted.
  216. X.P
  217. XAdding new field names.
  218. X.I Cfc
  219. Xjust uses very generic field names, everywhere, when names like ``user,''
  220. X``host,'' and ``relay'' might be more descriptive.
  221. X.P
  222. XMiscellanious formatting.
  223. X.I Cfc
  224. Xintroduces tabs on its own, as well as often passing through tabs
  225. Xfrom the
  226. X.I sendmail
  227. Xinput.
  228. XIt will also print a header for each different type of line, e.g. if the
  229. Xinput had seven
  230. X.B O
  231. X(option) lines, there will be seven option blocks.
  232. XThese are usually succesive, and can therefore be merged.
  233. XFinally, the block close on rulesets often comes after the comments that
  234. Xprecede the next ruleset or mailer specification.
  235. X.RE
  236. X.P
  237. XIn short,
  238. X.I cfc
  239. Xdoes over 90% of the tedious work of translating a
  240. X.B sendmail.cf
  241. Xinto
  242. X.I ease
  243. Xformat.
  244. XThe rest of the work can be done in a day or less.
  245. XSuprisingly, the combination of
  246. X.I cfc
  247. Xand
  248. X.I ease
  249. Xcan find bugs in a current
  250. X.B sendmail.cf
  251. Xfile!
  252. X.P
  253. X.I Cfc takes two options.
  254. X.RS
  255. X.TP
  256. X.B \-c
  257. XIndicates that
  258. X.I cfc
  259. Xshould run in 4.2BSD compatibility mode.
  260. XIn this case, options and mailer flags which are new in the 4.3BSD
  261. Xversion of
  262. X.I sendmail
  263. Xwill not be recognized.
  264. X.TP
  265. X.B \-u
  266. X.I Cfc
  267. Xwill warn about the use of any undocumented options or mailer flags in
  268. Xthe 4.3BSD
  269. X.IR sendmail .
  270. XThe correct
  271. X.I ease
  272. Xoutput will still be produced.
  273. X.RE
  274. X.\" .SH FILES
  275. X.SH SEE ALSO
  276. X.I "Sendmail Installation and Operation Guide"
  277. Xby Eric Allman
  278. X(SMM:7 in the 4.3 BSD UNIX System Manager's Manual),
  279. X.I "Ease: A Configuration Language for Sendmail"
  280. Xby James S. Schoner, amended by Jeff P. Stearns and Arnold D. Robbins,
  281. X.IR sendmail (8),
  282. X.IR ease (1).
  283. X.SH DIAGNOSTICS
  284. X``\c
  285. X.IR Routine :
  286. Xmalformed input line
  287. X.IR line :
  288. Xfatal error''
  289. Xfor input it doesn't understand.
  290. X.I Routine
  291. Xis the name of the routine in
  292. X.I cfc
  293. Xwhich choked, and
  294. X.I line
  295. Xis the line number in the input.
  296. X.SH BUGS
  297. XOnly recognizes continuation lines (lines that begin with a \s-1TAB\s+1)
  298. Xfor header (H) and mailer (M) definitions.
  299. X.P
  300. XShould read from files on the command line, instead of being a pure filter.
  301. X.SH AUTHOR
  302. X.nf
  303. XArnold Robbins
  304. XEmory University Computing Center
  305. Xarnold@emory.edu
  306. X.fi
  307. END_OF_FILE
  308. if test 3571 -ne `wc -c <'cfc/cfc.1'`; then
  309.     echo shar: \"'cfc/cfc.1'\" unpacked with wrong size!
  310. fi
  311. chmod +x 'cfc/cfc.1'
  312. # end of 'cfc/cfc.1'
  313. fi
  314. if test ! -d 'doc' ; then
  315.     echo shar: Creating directory \"'doc'\"
  316.     mkdir 'doc'
  317. fi
  318. if test -f 'doc/Makefile' -a "${1}" != "-c" ; then 
  319.   echo shar: Will not clobber existing file \"'doc/Makefile'\"
  320. else
  321. echo shar: Extracting \"'doc/Makefile'\" \(547 characters\)
  322. sed "s/^X//" >'doc/Makefile' <<'END_OF_FILE'
  323. X#
  324. X# $Header: Makefile,v 1.2 87/12/23 11:30:27 root Locked $
  325. X#
  326. X# $Log:    Makefile,v $
  327. X# Revision 1.2  87/12/23  11:30:27  root
  328. X# Added new appendix. ADR.
  329. X# 
  330. X# Revision 1.1  87/12/23  10:40:45  root
  331. X# Initial revision
  332. X# 
  333. X#
  334. X#
  335. X#    Makefile for Ease document.
  336. X#
  337. X#    James S. Schoner
  338. X#    Purdue University Computing Center
  339. X#
  340. Xall:    cover mainbody apen1 apen2 apen3 apen4
  341. X    
  342. Xcover: FRC
  343. X    troff -ms cover
  344. X
  345. Xmainbody:
  346. X    tbl ease.paper | troff -ms
  347. X
  348. Xapen1:
  349. X    tbl ap1 | troff -ms
  350. X
  351. Xapen2:
  352. X    tbl ap2 | troff -ms
  353. X
  354. Xapen3:
  355. X    tbl ap3 | troff -ms
  356. X
  357. Xapen4:
  358. X    tbl ap4 | troff -ms
  359. X
  360. XFRC:
  361. X
  362. END_OF_FILE
  363. if test 547 -ne `wc -c <'doc/Makefile'`; then
  364.     echo shar: \"'doc/Makefile'\" unpacked with wrong size!
  365. fi
  366. chmod +x 'doc/Makefile'
  367. # end of 'doc/Makefile'
  368. fi
  369. if test -f 'doc/ap1' -a "${1}" != "-c" ; then 
  370.   echo shar: Will not clobber existing file \"'doc/ap1'\"
  371. else
  372. echo shar: Extracting \"'doc/ap1'\" \(1394 characters\)
  373. sed "s/^X//" >'doc/ap1' <<'END_OF_FILE'
  374. X.DS C
  375. X\s+5\fBAppendix A\fR
  376. X
  377. X
  378. X\fBPre-Declared Macros\fR\s-5
  379. X.DE
  380. X.sp 5
  381. X.TS 
  382. Xcenter box;
  383. Xc|c|c
  384. Xl|l|l.
  385. X\fBEase\fR Macro    Raw Equivalent    Meaning*
  386. X=
  387. X\fIm_odate\fR    a    The origination date in Arpanet format
  388. X\fIm_adate\fR    b    The current date in Arpanet format
  389. X\fIm_hops\fR    c    The hop count
  390. X\fIm_udate\fR    d    The date in UNIX (ctime) format
  391. X\fIm_smtp\fR    e    The SMTP entry message
  392. X\fIm_saddr\fR    f    The sender (from) address
  393. X\fIm_sreladdr\fR    g    The sender address relative to the recipient
  394. X\fIm_rhost\fR    h    The recipient host
  395. X\fIm_qid\fR    i    The queue id
  396. X\fIm_oname\fR    j    The official domain name for this site
  397. X\fIm_ufrom\fR    l    The format of the UNIX from line
  398. X\fIm_daemon\fR    n    The name of the daemon (for error messages)
  399. X\fIm_addrops\fR    o    The set of "operators" in addresses
  400. X\fIm_pid\fR    p    Sendmail's pid
  401. X\fIm_defaddr\fR    q    The default format of sender address
  402. X\fIm_protocol\fR    r    Protocol used
  403. X\fIm_shostname\fR    s    Sender's host name
  404. X\fIm_ctime\fR    t    A numeric representation of the current time
  405. X\fIm_ruser\fR    u    The recipient user
  406. X\fIm_version\fR    v    The version number of sendmail
  407. X\fIm_sitename\fR    w    The hostname of this site
  408. X\fIm_sname\fR    x    The full name of the sender
  409. X\fIm_stty\fR    y    The id of the sender's tty
  410. X\fIm_rhdir\fR    z    The home directory of the recipient
  411. X.TE
  412. X.FS
  413. X*  Taken from pages 19 and 20 of the Sendmail Installation and Operation Guide
  414. X(SMM:7 in the 4.3 BSD UNIX System Manager's Manual), by Eric Allman.
  415. X.FE
  416. END_OF_FILE
  417. if test 1394 -ne `wc -c <'doc/ap1'`; then
  418.     echo shar: \"'doc/ap1'\" unpacked with wrong size!
  419. fi
  420. chmod +x 'doc/ap1'
  421. # end of 'doc/ap1'
  422. fi
  423. if test -f 'doc/ap2' -a "${1}" != "-c" ; then 
  424.   echo shar: Will not clobber existing file \"'doc/ap2'\"
  425. else
  426. echo shar: Extracting \"'doc/ap2'\" \(2432 characters\)
  427. sed "s/^X//" >'doc/ap2' <<'END_OF_FILE'
  428. X...
  429. X... $Header: ap2,v 1.5 88/06/15 10:11:53 root Locked $
  430. X... 
  431. X... $Log:    ap2,v $
  432. X... Revision 1.5  88/06/15  10:11:53  root
  433. X... Added undocumented/unimplemented options. Fixed so it would troff well. ADR.
  434. X... 
  435. X... Revision 1.4  88/01/21  17:10:33  root
  436. X... Added new option; change location of Sendmail doc to 4.3 SMM. ADR.
  437. X... 
  438. X... Revision 1.3  87/09/04  14:55:36  root
  439. X... Fixed typo in new options. ADR.
  440. X... 
  441. X... Revision 1.2  87/03/03  17:05:41  root
  442. X... Changes for 4.3 version of sendmail. ADR.
  443. X... 
  444. X... Revision 1.1  87/03/03  17:01:24  root
  445. X... Initial revision
  446. X... 
  447. X...
  448. X.DS C
  449. X\s+5\fBAppendix B\fR
  450. X
  451. X\fBSendmail Options\fR\s-5
  452. X.DE
  453. X.PP
  454. XFor a complete description of Sendmail's options and their values, refer to 
  455. XAppendix B of the Sendmail Installation and Operation Guide (SMM:7 in the
  456. X4.3 BSD UNIX System Manager's Manual), by Eric Allman.
  457. X.sp
  458. X.TS 
  459. Xcenter box;
  460. Xc|c
  461. Xl|l.
  462. XSendmail Option (\fBEase\fR)    Sendmail Option (Raw)    Special Values
  463. X=
  464. X\fIo_alias\fR    A    
  465. X\fIo_ewait\fR    a    
  466. X\fIo_bsub\fR    B    
  467. X\fIo_checkpoint\fR    C *
  468. X\fIo_qwait\fR    c    
  469. X\fIo_delivery\fR  (special values below)    d  (special values below)
  470. X     \fId_interactive\fR         i 
  471. X     \fId_background\fR        b 
  472. X     \fId_queue\fR        q
  473. X\fIo_rebuild\fR    D
  474. X\fIo_handling\fR  (special values below)    e  (special values below)
  475. X     \fIh_print\fR         p 
  476. X     \fIh_exit\fR         q
  477. X     \fIh_mail\fR         m
  478. X     \fIh_write\fR         w
  479. X     \fIh_mailz\fR         e
  480. X\fIo_tmode\fR    F    
  481. X\fIo_usave\fR    f    
  482. X\fIo_gid\fR    g    
  483. X\fIo_fsmtp\fR    H    
  484. X\fIo_skipd\fR    i    
  485. X\fIo_slog\fR    L    
  486. X\fIo_rsend\fR    m    
  487. X\fIo_dnet\fR    N    
  488. X\fIo_validate\fR    n \(dg
  489. X\fIo_hformat\fR    o    
  490. X\fIo_pmaster\fR    P \(bu
  491. X\fIo_qdir\fR    Q    
  492. X\fIo_qfactor\fR    q
  493. X\fIo_tread\fR    r    
  494. X\fIo_flog\fR    S    
  495. X\fIo_safe\fR    s    
  496. X\fIo_qtimeout\fR    T    
  497. X\fIo_timezone\fR    t    
  498. X\fIo_dmuid\fR    u    
  499. X\fIo_verbose\fR    v    
  500. X\fIo_wizpass\fR    W    
  501. X\fIo_loadq\fR    x    
  502. X\fIo_loadnc\fR    X    
  503. X\fIo_recipfactor\fR    y
  504. X\fIo_newproc\fR    Y
  505. X\fIo_prifactor\fR    z
  506. X\fIo_waitfactor\fR    Z
  507. X.TE
  508. X.PP
  509. X* This option is undocumented and unimplemented in 4.3BSD. It is
  510. Xfor checkpointing mail after \fIN\fR failed connections. \fBEase\fR supports
  511. Xit in anticipation of future developments.
  512. X.PP
  513. X\(dg This option is undocumented in 4.3BSD. It specifies that the right hand
  514. Xside of an alias definition should be checked for validity as an address
  515. Xwhen the alias database is being rebuilt.
  516. X.PP
  517. X\(bu This option is undocumented in 4.3BSD.
  518. XIt specifies the address of a Postmaster who should be carbon-copied on
  519. Xall returned bad mail.
  520. END_OF_FILE
  521. if test 2432 -ne `wc -c <'doc/ap2'`; then
  522.     echo shar: \"'doc/ap2'\" unpacked with wrong size!
  523. fi
  524. chmod +x 'doc/ap2'
  525. # end of 'doc/ap2'
  526. fi
  527. if test -f 'doc/ap3' -a "${1}" != "-c" ; then 
  528.   echo shar: Will not clobber existing file \"'doc/ap3'\"
  529. else
  530. echo shar: Extracting \"'doc/ap3'\" \(1366 characters\)
  531. sed "s/^X//" >'doc/ap3' <<'END_OF_FILE'
  532. X...
  533. X... $Header: ap3,v 1.4 88/06/15 10:12:22 root Locked $
  534. X... 
  535. X... $Log:    ap3,v $
  536. X... Revision 1.4  88/06/15  10:12:22  root
  537. X... Added undocumented and unimplemented mailer flag.
  538. X... 
  539. X... Revision 1.3  88/01/21  17:10:57  root
  540. X... Changed location of Sendmail doc to 4.3 SMM. ADR.
  541. X... 
  542. X... Revision 1.2  87/03/03  17:05:53  root
  543. X... Changes for 4.3 version of sendmail. ADR.
  544. X... 
  545. X... Revision 1.1  87/03/03  17:04:52  root
  546. X... Initial revision
  547. X... 
  548. X...
  549. X.DS C
  550. X\s+5\fBAppendix C\fR
  551. X
  552. X
  553. X\fBMailer Flags\fR\s-5
  554. X.DE
  555. X.sp 5
  556. X.PP
  557. XFor a complete description of mailer flags, refer to 
  558. XAppendix C of the Sendmail Installation and Operation Guide (SMM:7 in the
  559. X4.3 BSD UNIX System Manager's Manual), by Eric Allman.
  560. X.sp 5
  561. X.TS 
  562. Xcenter box;
  563. Xc|c
  564. Xl|l.
  565. XMailer Flag (\fBEase\fR)    Mailer Flag (Raw)
  566. X=
  567. X\fIf_ffrom\fR    f
  568. X\fIf_rfrom\fR    r
  569. X\fIf_noreset\fR    S
  570. X\fIf_noufrom\fR    n
  571. X\fIf_locm\fR    l
  572. X\fIf_strip\fR    s 
  573. X\fIf_mult\fR    m
  574. X\fIf_from\fR    F
  575. X\fIf_date\fR    D
  576. X\fIf_mesg\fR    M
  577. X\fIf_full\fR    x    
  578. X\fIf_return\fR    P    
  579. X\fIf_upperu\fR    u    
  580. X\fIf_upperh\fR    h    
  581. X\fIf_arpa\fR    A    
  582. X\fIf_ufrom\fR    U    
  583. X\fIf_expensive\fR    e    
  584. X\fIf_dot\fR    X    
  585. X\fIf_llimit\fR    L    
  586. X\fIf_retsmtp\fR    p    
  587. X\fIf_smtp\fR    I    
  588. X\fIf_addrw\fR    C    
  589. X\fIf_escape\fR    E
  590. X\fIf_rport\fR    R *
  591. X.TE
  592. X.FS
  593. X*  This flag specifies the use of a reserved TCP port. In 4.3BSD it is
  594. Xboth undocumented and unimplemented. \fBEase\fR supports it in anticipation
  595. Xof future developments.
  596. X.FE
  597. END_OF_FILE
  598. if test 1366 -ne `wc -c <'doc/ap3'`; then
  599.     echo shar: \"'doc/ap3'\" unpacked with wrong size!
  600. fi
  601. chmod +x 'doc/ap3'
  602. # end of 'doc/ap3'
  603. fi
  604. if test -f 'doc/ap4' -a "${1}" != "-c" ; then 
  605.   echo shar: Will not clobber existing file \"'doc/ap4'\"
  606. else
  607. echo shar: Extracting \"'doc/ap4'\" \(208 characters\)
  608. sed "s/^X//" >'doc/ap4' <<'END_OF_FILE'
  609. X.DS C
  610. X\s+5\fBAppendix D\fR
  611. X
  612. X
  613. X\fBPre-Defined Classes\fR\s-5
  614. X.DE
  615. X.sp 5
  616. X.TS 
  617. Xcenter box;
  618. Xc|c|c
  619. Xl|l|l.
  620. X\fBEase\fR Class    Raw Equivalent    Meaning
  621. X=
  622. X\fIc_myname\fR    w    The list of names by which this host is known
  623. X.TE
  624. END_OF_FILE
  625. if test 208 -ne `wc -c <'doc/ap4'`; then
  626.     echo shar: \"'doc/ap4'\" unpacked with wrong size!
  627. fi
  628. chmod +x 'doc/ap4'
  629. # end of 'doc/ap4'
  630. fi
  631. if test -f 'doc/cover' -a "${1}" != "-c" ; then 
  632.   echo shar: Will not clobber existing file \"'doc/cover'\"
  633. else
  634. echo shar: Extracting \"'doc/cover'\" \(640 characters\)
  635. sed "s/^X//" >'doc/cover' <<'END_OF_FILE'
  636. X...
  637. X... $Header: cover,v 1.2 87/12/23 11:30:36 root Locked $
  638. X...
  639. X... $Log:    cover,v $
  640. X... Revision 1.2  87/12/23  11:30:36  root
  641. X... Updated list of authors. ADR.
  642. X... 
  643. X... Revision 1.1  87/12/23  10:16:35  root
  644. X... Initial revision
  645. X... 
  646. X...
  647. X.DA
  648. X.sp 15
  649. X.nr PS 14
  650. X.ps 14
  651. X.DS C
  652. X.DE
  653. X.sp 10
  654. X.nr PS 36
  655. X.ps 36
  656. X.DS C
  657. X\fBEase:\fR
  658. X.DE
  659. X.sp 5
  660. X.nr PS 22
  661. X.ps 22
  662. X.DS C
  663. XA Configuration Language
  664. X  
  665. Xfor Sendmail
  666. X.DE
  667. X.sp 8
  668. X.nr PS 14
  669. X.ps 14
  670. X.DS C
  671. Xby
  672. X
  673. X\fIJames S. Schoner\fR
  674. X\fIPurdue University Computing Center\fR
  675. X
  676. XAmended by
  677. X
  678. X\fIJeff P. Stearns\fR
  679. X\fIJohn Fluke Manufacturing Company\fR
  680. X
  681. X\fIArnold D. Robbins\fR
  682. X\fIEmory University Computing Center\fR
  683. X.DE
  684. END_OF_FILE
  685. if test 640 -ne `wc -c <'doc/cover'`; then
  686.     echo shar: \"'doc/cover'\" unpacked with wrong size!
  687. fi
  688. chmod +x 'doc/cover'
  689. # end of 'doc/cover'
  690. fi
  691. if test ! -d 'local' ; then
  692.     echo shar: Creating directory \"'local'\"
  693.     mkdir 'local'
  694. fi
  695. if test -f 'local/Makefile' -a "${1}" != "-c" ; then 
  696.   echo shar: Will not clobber existing file \"'local/Makefile'\"
  697. else
  698. echo shar: Extracting \"'local/Makefile'\" \(260 characters\)
  699. sed "s/^X//" >'local/Makefile' <<'END_OF_FILE'
  700. X# Makefile for 'ease'
  701. X#
  702. X
  703. XEASE_SH= ease.ksh
  704. X#EASE_SH= ease.sh
  705. X
  706. Xinstall: ../src/et $(EASE_SH)
  707. X    install -c -s ../src/et /usr/local/lib
  708. X    cp $(EASE_SH) /usr/local/bin/ease
  709. X    chmod 755 /usr/local/bin/ease
  710. X    cp ease.1 /usr/man/manl/ease.l
  711. X
  712. X../src/et:
  713. X    cd ../src ; make
  714. END_OF_FILE
  715. if test 260 -ne `wc -c <'local/Makefile'`; then
  716.     echo shar: \"'local/Makefile'\" unpacked with wrong size!
  717. fi
  718. chmod +x 'local/Makefile'
  719. # end of 'local/Makefile'
  720. fi
  721. if test -f 'local/ease.1' -a "${1}" != "-c" ; then 
  722.   echo shar: Will not clobber existing file \"'local/ease.1'\"
  723. else
  724. echo shar: Extracting \"'local/ease.1'\" \(788 characters\)
  725. sed "s/^X//" >'local/ease.1' <<'END_OF_FILE'
  726. X.TH EASE 1 local
  727. X.SH NAME
  728. Xease \- build sendmail configuration files from readable descriptions
  729. X.SH SYNOPSIS
  730. X.B ease
  731. X[
  732. X.I cpp
  733. Xoptions ]
  734. X[ input_file ...  ] [
  735. X.B \-o
  736. Xoutput_file ]
  737. X.SH DESCRIPTION
  738. X.I Ease
  739. Xis a simple shell script that
  740. Xruns the C preprocessor, piping the output into the Ease Translator.
  741. X.PP
  742. XIf the
  743. X.B \-o
  744. Xoption is given, the named file will be used for the generated
  745. Xconfiguration information, otherwise the standard output is used.
  746. X.PP
  747. XBy default,
  748. X.I ease
  749. Xwill read and write the standard input and output.
  750. X.SH FILES
  751. X/lib/cpp
  752. X.br
  753. X/usr/local/lib/et
  754. X.SH SEE ALSO
  755. X.I "Ease: A Configuration Language for Sendmail"
  756. Xby James S. Schoner,
  757. Xpublished in the January/February 1986 Usenix
  758. X.IR ;login: .
  759. X.SH DIAGNOSTICS
  760. XA simple usage message if inappropriate arguments are supplied.
  761. END_OF_FILE
  762. if test 788 -ne `wc -c <'local/ease.1'`; then
  763.     echo shar: \"'local/ease.1'\" unpacked with wrong size!
  764. fi
  765. chmod +x 'local/ease.1'
  766. # end of 'local/ease.1'
  767. fi
  768. if test -f 'local/ease.ksh' -a "${1}" != "-c" ; then 
  769.   echo shar: Will not clobber existing file \"'local/ease.ksh'\"
  770. else
  771. echo shar: Extracting \"'local/ease.ksh'\" \(694 characters\)
  772. sed "s/^X//" >'local/ease.ksh' <<'END_OF_FILE'
  773. X#! /bin/ksh
  774. X
  775. X# ease -- run /lib/cpp and send the output into the ease translator
  776. X#
  777. X# usage: ease [ cpp options ] [ input files ] [ -o output_file ]
  778. X
  779. XPATH=/bin:/usr/ucb:/usr/bin
  780. Xexport PATH
  781. X
  782. Xfunction usage
  783. X{
  784. X    echo usage: ease [ cpp options ] [ input files ] [ -o output_file ] 1>&2
  785. X    exit 1
  786. X}
  787. X
  788. Xifiles=
  789. Xofile=
  790. Xopts=
  791. X
  792. Xwhile [ $# -gt 0 ]
  793. Xdo
  794. X    case "$1" in
  795. X    -o)    if [ "$2" ]
  796. X        then
  797. X            ofile="$2"
  798. X            shift
  799. X        else
  800. X            usage
  801. X        fi
  802. X        ;;
  803. X    -o?*)    ofile="${1#-o}" ;;
  804. X    -?*)    opts="$opts $1" ;;    # probably -D or -I cpp options
  805. X    *)    ifiles="$ifiles $1" ;;    # will catch plain "-"
  806. X    esac
  807. X    shift
  808. Xdone
  809. X
  810. X# use cat, since it understands the "-" convention
  811. X
  812. Xcat $ifiles | /lib/cpp $opts | cat -s | /usr/local/lib/et - $ofile
  813. END_OF_FILE
  814. if test 694 -ne `wc -c <'local/ease.ksh'`; then
  815.     echo shar: \"'local/ease.ksh'\" unpacked with wrong size!
  816. fi
  817. chmod +x 'local/ease.ksh'
  818. # end of 'local/ease.ksh'
  819. fi
  820. if test -f 'local/ease.sh' -a "${1}" != "-c" ; then 
  821.   echo shar: Will not clobber existing file \"'local/ease.sh'\"
  822. else
  823. echo shar: Extracting \"'local/ease.sh'\" \(686 characters\)
  824. sed "s/^X//" >'local/ease.sh' <<'END_OF_FILE'
  825. X#! /bin/sh
  826. X
  827. X# ease -- run /lib/cpp and send the output into the ease translator
  828. X#
  829. X# usage: ease [ cpp options ] [ input files ] [ -o output_file ]
  830. X
  831. XPATH=/bin:/usr/ucb:/usr/bin
  832. Xexport PATH
  833. X
  834. Xifiles=
  835. Xofile=
  836. Xopts=
  837. X
  838. Xwhile [ $# -gt 0 ]
  839. Xdo
  840. X    case "$1" in
  841. X    -o)    if [ "$2" ]
  842. X        then
  843. X            ofile="$2"
  844. X            shift
  845. X        else
  846. X            echo "usage: ease [ cpp options ] [ input files ] [ -o output_file ]" 1>&2
  847. X            exit 1
  848. X        fi
  849. X        ;;
  850. X    -o?*)    ofile="`expr $1 : '-o\(..*\)'`" ;;
  851. X    -?*)    opts="$opts $1" ;;    # probably -D or -I cpp options
  852. X    *)    ifiles="$ifiles $1" ;;    # will catch plain "-"
  853. X    esac
  854. X    shift
  855. Xdone
  856. X
  857. X# use cat, since it understands the "-" convention
  858. X
  859. Xcat $ifiles | /lib/cpp $opts | cat -s | /usr/local/lib/et - $ofile
  860. END_OF_FILE
  861. if test 686 -ne `wc -c <'local/ease.sh'`; then
  862.     echo shar: \"'local/ease.sh'\" unpacked with wrong size!
  863. fi
  864. chmod +x 'local/ease.sh'
  865. # end of 'local/ease.sh'
  866. fi
  867. if test ! -d 'src' ; then
  868.     echo shar: Creating directory \"'src'\"
  869.     mkdir 'src'
  870. fi
  871. if test -f 'src/Makefile' -a "${1}" != "-c" ; then 
  872.   echo shar: Will not clobber existing file \"'src/Makefile'\"
  873. else
  874. echo shar: Extracting \"'src/Makefile'\" \(3136 characters\)
  875. sed "s/^X//" >'src/Makefile' <<'END_OF_FILE'
  876. X# Makefile for Ease Translator (et).
  877. X#
  878. X#    $Header: Makefile,v 2.0 88/06/15 14:47:35 root Exp $
  879. X#
  880. X#    $Log:    Makefile,v $
  881. X# Revision 2.0  88/06/15  14:47:35  root
  882. X# Baseline release for net posting. ADR.
  883. X# 
  884. X#
  885. X#    James S. Schoner, Purdue University Computing Center,
  886. X#              West Lafayette, Indiana  47907
  887. X#
  888. X#    Copyright (c) 1985 by Purdue Research Foundation
  889. X#
  890. X#    All rights reserved.
  891. X#
  892. X
  893. XINCLUDE =
  894. X
  895. XDEST = /usr/local/bin
  896. X
  897. XOWNER = root
  898. XGROUP = staff
  899. XMODE = 755
  900. X
  901. XDEFS =
  902. XCFLAGS = -O ${DEFS} ${INCLUDE}
  903. X
  904. XLP = lpr
  905. XLPFLAGS = -J"Ease Source"
  906. X
  907. XHDR = symtab.h
  908. XSRC = main.c emitcf.c errors.c idman.c strops.c symtab.c fixstrings.c
  909. XLST = Makefile lexan.l parser.y ${HDR} ${SRC}
  910. XDEP = parser.c lexan.c ${SRC}
  911. XOBJ = parser.o lexan.o main.o emitcf.o errors.o idman.o strops.o symtab.o \
  912. X    fixstrings.o
  913. X
  914. XCFILES= $(SRC) $(DEP)
  915. X
  916. Xet: ${OBJ}
  917. X    cc ${CFLAGS} -o et ${OBJ} -ll
  918. X
  919. Xclean: FRC
  920. X    rm -f et *.o lexan.c parser.c y.output yacc.acts yacc.tmp \
  921. X          lexdefs.h y.tab.h errs Makefile.bak
  922. X
  923. Xdepend:
  924. X    ${CC} -M ${CFLAGS} ${CFILES} | \
  925. X    sed -e ':loop' \
  926. X        -e 's/\.\.\/[^ /]*\/\.\./../' \
  927. X        -e 't loop' | \
  928. X    awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
  929. X        else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
  930. X               else rec = rec " " $$2 } } ; \
  931. X          END { print rec } ' > makedep
  932. X    echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
  933. X    echo '$$r makedep' >>eddep
  934. X    echo 'w' >>eddep
  935. X    cp Makefile Makefile.bak
  936. X    ex - Makefile < eddep
  937. X    rm eddep makedep
  938. X
  939. Xinstall: et FRC
  940. X    install -c -m ${MODE} -o ${OWNER} -g ${GROUP} -s et ${DEST}
  941. X
  942. Xlint:   ${DEP} symtab.h FRC
  943. X    lint -hxn ${DEP}
  944. X
  945. Xprint:  ${LST} FRC
  946. X    @pr -f ${LST} | ${LP} ${LPFLAGS}
  947. X
  948. Xspotless: clean FRC
  949. X    rcsclean ${LST}
  950. X
  951. Xy.tab.h parser.c: parser.y
  952. X    @rm -f parser.c
  953. X    yacc -d parser.y
  954. X    mv y.tab.c parser.c
  955. X
  956. X# the following dummy rule is because of the results of 'make depend'
  957. X./lexdefs.h:    lexdefs.h
  958. X
  959. Xlexdefs.h:    y.tab.h
  960. X    -(cmp -s y.tab.h lexdefs.h || cp y.tab.h lexdefs.h)
  961. X
  962. Xlexan.c: lexan.l
  963. X
  964. X${HDR} ${SRC} lexan.l parser.y:
  965. X    co $@
  966. X
  967. XFRC:
  968. X
  969. X# DO NOT DELETE THIS LINE -- make depend uses it
  970. X
  971. Xmain.o: main.c ./fixstrings.h /usr/include/stdio.h
  972. Xemitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  973. Xerrors.o: errors.c /usr/include/stdio.h ./fixstrings.h
  974. Xidman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  975. Xstrops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
  976. Xstrops.o: ./symtab.h
  977. Xsymtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
  978. Xsymtab.o: ./symtab.h
  979. Xfixstrings.o: fixstrings.c /usr/include/strings.h
  980. Xparser.o: parser.c ./fixstrings.h /usr/include/stdio.h ./symtab.h
  981. Xlexan.o: lexan.c /usr/include/stdio.h ./fixstrings.h ./symtab.h ./lexdefs.h
  982. Xmain.o: main.c ./fixstrings.h /usr/include/stdio.h
  983. Xemitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  984. Xerrors.o: errors.c /usr/include/stdio.h ./fixstrings.h
  985. Xidman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  986. Xstrops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
  987. Xstrops.o: ./symtab.h
  988. Xsymtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
  989. Xsymtab.o: ./symtab.h
  990. Xfixstrings.o: fixstrings.c /usr/include/strings.h
  991. END_OF_FILE
  992. if test 3136 -ne `wc -c <'src/Makefile'`; then
  993.     echo shar: \"'src/Makefile'\" unpacked with wrong size!
  994. fi
  995. chmod +x 'src/Makefile'
  996. # end of 'src/Makefile'
  997. fi
  998. if test -f 'src/errors.c' -a "${1}" != "-c" ; then 
  999.   echo shar: Will not clobber existing file \"'src/errors.c'\"
  1000. else
  1001. echo shar: Extracting \"'src/errors.c'\" \(2455 characters\)
  1002. sed "s/^X//" >'src/errors.c' <<'END_OF_FILE'
  1003. X/*    $Header: errors.c,v 2.0 88/06/15 14:41:10 root Exp $    */
  1004. X
  1005. X/*
  1006. X * $Log:    errors.c,v $
  1007. X * Revision 2.0  88/06/15  14:41:10  root
  1008. X * Baseline release for net posting. ADR.
  1009. X * 
  1010. X */
  1011. X
  1012. X/*
  1013. X *      errors.c   -- Contains error initialization and reporting routines.
  1014. X *
  1015. X *      author     -- James S. Schoner, Purdue University Computing Center,
  1016. X *                        West Lafayette, Indiana  47907
  1017. X *
  1018. X *      date       -- July 9, 1985
  1019. X *
  1020. X *    Copyright (c) 1985 by Purdue Research Foundation
  1021. X *
  1022. X *    All rights reserved.
  1023. X *
  1024. X */
  1025. X
  1026. X#include <stdio.h>
  1027. X#include "fixstrings.h"
  1028. X
  1029. Xextern int  ErrorCount;     /* error count                   */
  1030. Xextern char FNbuf[];     /* input file name              */
  1031. Xextern int  Lcount;     /* line count                    */
  1032. XFILE *DIAGf = {stderr};  /* file for diagnostic output */
  1033. X
  1034. X
  1035. X/*
  1036. X *    ErrorReport () -- Prints source file name (FNbuf), line number (Lcount),
  1037. X *              and error message (sbErr) for each invokation.
  1038. X *
  1039. X */
  1040. Xvoid
  1041. XErrorReport (sbErr)
  1042. Xchar *sbErr;
  1043. X{
  1044. X    fprintf (DIAGf, "%s, line %d: %s", FNbuf, Lcount, sbErr);
  1045. X    ErrorCount++;
  1046. X}
  1047. X
  1048. X
  1049. X/*
  1050. X *    FatalError () -- Translator fatal error routine which prints 
  1051. X *             error message (sbErr) and an argument (sbArg).
  1052. X *
  1053. X */
  1054. Xvoid
  1055. XFatalError (sbErr, sbArg)
  1056. Xchar *sbErr,
  1057. X     *sbArg;
  1058. X{
  1059. X    fprintf (DIAGf, "%s, line %d: Fatal Error In Translator: %s %s\n", 
  1060. X         FNbuf, Lcount, sbErr, sbArg);
  1061. X    exit (1);
  1062. X}
  1063. X
  1064. X
  1065. X/*
  1066. X *    yyerror () -- Prints source file name (FNbuf), line number (Lcount),
  1067. X *              and error message (sbErr) for each invokation.
  1068. X *
  1069. X */
  1070. Xvoid
  1071. Xyyerror (sbErr)
  1072. Xchar *sbErr;
  1073. X{
  1074. X    fprintf (DIAGf, "%s, line %d: %s\n", FNbuf, Lcount, sbErr);
  1075. X    ErrorCount++;
  1076. X}
  1077. X
  1078. X
  1079. X/*
  1080. X *    PrintError () -- Prints source file name (FNbuf), line number
  1081. X *             (cline), error message (sbErr), and argument
  1082. X *             (sbArg) for each invokation.
  1083. X *
  1084. X */
  1085. Xvoid
  1086. XPrintError (sbErr, sbArg)
  1087. Xchar *sbErr;
  1088. Xchar *sbArg;
  1089. X{
  1090. X    fprintf (DIAGf, "%s, line %d: %s %s.\n", FNbuf, Lcount, sbErr, sbArg);
  1091. X    ErrorCount++;
  1092. X}
  1093. X
  1094. X
  1095. X/*
  1096. X *    PrintWarning () -- Prints a warning message with source file
  1097. X *               name (FNbuf), line number (Lcount), warning
  1098. X *               (sbWarn), and a possible identifier (sbID).
  1099. X *
  1100. X */
  1101. Xvoid
  1102. XPrintWarning (sbWarn, sbID)
  1103. Xchar *sbWarn;
  1104. Xchar *sbID;
  1105. X{
  1106. X    fprintf (DIAGf, "%s, line %d: Warning: ", FNbuf, Lcount);
  1107. X    if (sbID != NULL)
  1108. X        fprintf (DIAGf, sbWarn, sbID);
  1109. X    else
  1110. X        fprintf (DIAGf, sbWarn);
  1111. X}
  1112. X
  1113. X
  1114. X/*
  1115. X *    InitError () -- Initialize line count (Lcount) to one and error count
  1116. X *                (ErrorCount) to zero.
  1117. X *
  1118. X */
  1119. Xvoid
  1120. XInitError ()
  1121. X{
  1122. X    Lcount     = 1;
  1123. X    ErrorCount = 0;
  1124. X}
  1125. END_OF_FILE
  1126. if test 2455 -ne `wc -c <'src/errors.c'`; then
  1127.     echo shar: \"'src/errors.c'\" unpacked with wrong size!
  1128. fi
  1129. chmod +x 'src/errors.c'
  1130. # end of 'src/errors.c'
  1131. fi
  1132. if test -f 'src/fixstrings.c' -a "${1}" != "-c" ; then 
  1133.   echo shar: Will not clobber existing file \"'src/fixstrings.c'\"
  1134. else
  1135. echo shar: Extracting \"'src/fixstrings.c'\" \(1701 characters\)
  1136. sed "s/^X//" >'src/fixstrings.c' <<'END_OF_FILE'
  1137. X/*
  1138. X * $Source: /usr/src/local/local.bin/ease/src/RCS/fixstrings.c,v $
  1139. X * $Locker:  $
  1140. X *
  1141. X * $Revision: 2.0 $
  1142. X * Check-in $Date: 88/06/15 14:41:19 $
  1143. X * $State: Exp $
  1144. X *
  1145. X * $Author: root $
  1146. X *
  1147. X * $Log:    fixstrings.c,v $
  1148. X * Revision 2.0  88/06/15  14:41:19  root
  1149. X * Baseline release for net posting. ADR.
  1150. X * 
  1151. X * Version 1.3  87/03/05  19:38:33  jeff
  1152. X * Edited RCS header and FLUKEid[] string.
  1153. X * 
  1154. X * Version 1.2  87/02/25  16:55:13  jeff
  1155. X * Add some RCS header lines.  No code changes.
  1156. X * 
  1157. X */
  1158. X
  1159. X/*  FLUKE jps 16-apr-86 - special hacks for NULL pointers.
  1160. X *
  1161. X *  The author of ease used a *lot* of NULL pointers.  This isn't much
  1162. X *  of a problem on a vax, where NULL pointers look like "".  Not so on a Sun.
  1163. X *
  1164. X *  We hack around the problem by defining a set of wrappers for the
  1165. X *  standard string functions, making it appear as though they accept NULL
  1166. X *  pointers.  In the other C files, cpp macros are used to revector the
  1167. X *  standard string functions to this file.
  1168. X */
  1169. X#include <strings.h>
  1170. X#define fix(s) ((s) ? (s) : "")
  1171. X
  1172. Xchar *Xstrcat (s1, s2)
  1173. Xchar *s1, *s2; 
  1174. X{
  1175. X    return (strcat (s1, fix (s2)));
  1176. X}
  1177. X
  1178. Xchar *Xstrncat (s1, s2, n)
  1179. Xchar *s1, *s2; 
  1180. X{
  1181. X    return (strncat (s1, fix (s2), n));
  1182. X}
  1183. X
  1184. XXstrcmp (s1, s2)
  1185. Xchar *s1, *s2; 
  1186. X{
  1187. X    return (strcmp (fix (s1), fix (s2)));
  1188. X}
  1189. X
  1190. XXstrncmp (s1, s2, n)
  1191. Xchar *s1, *s2; 
  1192. X{
  1193. X    return (strncmp (fix (s1), fix (s2), n));
  1194. X}
  1195. X
  1196. Xchar *Xstrcpy (s1, s2)
  1197. Xchar *s1, *s2; 
  1198. X{
  1199. X    return (strcpy (s1, fix (s2)));
  1200. X}
  1201. X
  1202. Xchar *Xstrncpy (s1, s2, n)
  1203. Xchar *s1, *s2; 
  1204. X{
  1205. X    return (strncpy (s1, fix (s2), n));
  1206. X}
  1207. X
  1208. XXstrlen (s)
  1209. Xchar *s; 
  1210. X{
  1211. X    return (strlen (fix (s)));
  1212. X}
  1213. X
  1214. Xchar *Xindex (s, c)
  1215. Xchar *s, c; 
  1216. X{
  1217. X    return (index (fix (s), c));
  1218. X}
  1219. X
  1220. Xchar *Xrindex (s, c)
  1221. Xchar *s, c; 
  1222. X{
  1223. X    return (rindex (fix (s), c));
  1224. X}
  1225. END_OF_FILE
  1226. if test 1701 -ne `wc -c <'src/fixstrings.c'`; then
  1227.     echo shar: \"'src/fixstrings.c'\" unpacked with wrong size!
  1228. fi
  1229. chmod +x 'src/fixstrings.c'
  1230. # end of 'src/fixstrings.c'
  1231. fi
  1232. if test -f 'src/fixstrings.h' -a "${1}" != "-c" ; then 
  1233.   echo shar: Will not clobber existing file \"'src/fixstrings.h'\"
  1234. else
  1235. echo shar: Extracting \"'src/fixstrings.h'\" \(811 characters\)
  1236. sed "s/^X//" >'src/fixstrings.h' <<'END_OF_FILE'
  1237. X/*
  1238. X * $Source: /usr/src/local/local.bin/ease/src/RCS/fixstrings.h,v $
  1239. X * $Locker:  $
  1240. X *
  1241. X * $Revision: 2.0 $
  1242. X * Check-in $Date: 88/06/15 14:41:57 $
  1243. X * $State: Exp $
  1244. X *
  1245. X * $Author: root $
  1246. X *
  1247. X * $Log:    fixstrings.h,v $
  1248. X * Revision 2.0  88/06/15  14:41:57  root
  1249. X * Baseline release for net posting. ADR.
  1250. X * 
  1251. X * Version 1.3  87/03/05  19:37:50  jeff
  1252. X * Edited RCS header and FLUKEid[] string.
  1253. X * 
  1254. X * Version 1.2  87/02/25  16:55:16  jeff
  1255. X * Add some RCS header lines.  No code changes.
  1256. X * 
  1257. X */
  1258. X
  1259. X/* FLUKE jps 16-apr-86 - revector the string routines to custom-coded ones
  1260. X *  which handle NULL pointers.
  1261. X */
  1262. X#define strcat    Xstrcat
  1263. X#define strncat    Xstrncat
  1264. X#define strcmp    Xstrcmp
  1265. X#define strncmp    Xstrncmp
  1266. X#define strcpy    Xstrcpy
  1267. X#define strncpy    Xstrncpy
  1268. X#define strlen    Xstrlen
  1269. X#define index    Xindex
  1270. X#define rindex    Xrindex
  1271. END_OF_FILE
  1272. if test 811 -ne `wc -c <'src/fixstrings.h'`; then
  1273.     echo shar: \"'src/fixstrings.h'\" unpacked with wrong size!
  1274. fi
  1275. chmod +x 'src/fixstrings.h'
  1276. # end of 'src/fixstrings.h'
  1277. fi
  1278. if test -f 'src/idman.c' -a "${1}" != "-c" ; then 
  1279.   echo shar: Will not clobber existing file \"'src/idman.c'\"
  1280. else
  1281. echo shar: Extracting \"'src/idman.c'\" \(5664 characters\)
  1282. sed "s/^X//" >'src/idman.c' <<'END_OF_FILE'
  1283. X/*    $Header: idman.c,v 2.0 88/06/15 14:42:14 root Exp $    */
  1284. X
  1285. X/*
  1286. X * $Log:    idman.c,v $
  1287. X * Revision 2.0  88/06/15  14:42:14  root
  1288. X * Baseline release for net posting. ADR.
  1289. X * 
  1290. X */
  1291. X
  1292. X/*
  1293. X *      idman.c    -- Contains routines for manipulating identifiers and their
  1294. X *           symbolic associations.
  1295. X *
  1296. X *      author    -- James S. Schoner, Purdue University Computing Center,
  1297. X *                     West Lafayette, Indiana  47907
  1298. X *
  1299. X *      date    -- July 9, 1985
  1300. X *
  1301. X *    Copyright (c) 1985 by Purdue Research Foundation
  1302. X *
  1303. X *    All rights reserved.
  1304. X *
  1305. X */
  1306. X
  1307. X#include <stdio.h>
  1308. X#include "symtab.h"
  1309. X#include "fixstrings.h"
  1310. X
  1311. Xextern struct he *LookupSymbol ();
  1312. Xextern void      FatalError (),
  1313. X          ErrorReport (),
  1314. X          PrintWarning (),
  1315. X          PrintError ();
  1316. X
  1317. Xshort Uchar = 'A';            /* for unique macro names */
  1318. X
  1319. X
  1320. X/*
  1321. X *    UniqMac () -- Assigns and returns a unique one-character macro
  1322. X *              name (upper-case) for an Ease macro name.
  1323. X *
  1324. X */
  1325. Xchar
  1326. XUniqMac (phe)
  1327. Xstruct he *phe;        /* symbol table entry for Ease macro */
  1328. X{
  1329. X    if ((phe->idval.idc = Uchar++) > 'Z')
  1330. X        FatalError ("Too many macro names (26 max)", (char *) NULL);
  1331. X    return (phe->idval.idc);
  1332. X}
  1333. X
  1334. X
  1335. X/*
  1336. X *    BindID () -- Binds either a ruleset or precedence identifier (phe) to
  1337. X *              an integer (vid).  The id type distinction is passed in
  1338. X *             the parameter idt.
  1339. X *
  1340. X */
  1341. Xvoid
  1342. XBindID (phe, vid, idt)
  1343. Xregister struct he *phe;    /* symbol table entry for an identifier    */
  1344. Xint vid;            /* value of the identifier           */
  1345. Xunsigned idt;            /* identifier type (ruleset or precedence) */
  1346. X{
  1347. X    if (ISTYPED(phe->idtype)) {    /* should be undefined */
  1348. X        PrintWarning ("Redeclaration of %s.\n", phe->psb);
  1349. X        phe->idtype = ID_UNTYPED;
  1350. X    }
  1351. X    phe->idtype |= idt;        /* make defined           */
  1352. X    if (ISRULESET(phe->idtype)) {
  1353. X        if (vid > VALRSNMAX) {
  1354. X            ErrorReport ("Ruleset number too large.\n");
  1355. X            return;
  1356. X        } else if (vid < 0) {
  1357. X            ErrorReport ("Ruleset number must be non-negative.\n");
  1358. X            return;
  1359. X        }
  1360. X        sprintf (phe->idval.rsn, "%d", vid);
  1361. X    } else 
  1362. X        phe->idval.prec = vid;
  1363. X}
  1364. X
  1365. X
  1366. X/*
  1367. X *    CheckRS () -- Checks validity of a ruleset identifier (phe) and 
  1368. X *              returns the ruleset string to which the identifier
  1369. X *              is bound.  If the ruleset identifier is invalid, the
  1370. X *              null string is returned.
  1371. X *
  1372. X */
  1373. Xchar *
  1374. XCheckRS (phe)
  1375. Xstruct he *phe;        /* symbol table entry for ruleset identifier */
  1376. X{
  1377. X    if (!ISRULESET(phe->idtype)) {
  1378. X        if (!ISTYPED(phe->idtype))
  1379. X            PrintError ("Ruleset identifier not bound to a number:", phe->psb);
  1380. X        else
  1381. X            PrintError ("Identifier not of ruleset type:", phe->psb);
  1382. X        return (NULL);
  1383. X    } else
  1384. X        return (phe->idval.rsn);
  1385. X}
  1386. X
  1387. X
  1388. X/*
  1389. X *    MakeMac () -- Declare a macro name (pmac) as a class and/or macro type 
  1390. X *              (targtype) and return the unique cf character assigned 
  1391. X *              to it.
  1392. X *
  1393. X */
  1394. Xchar
  1395. XMakeMac (pmac, targtype)
  1396. Xregister struct he *pmac;    /* symbol table entry for macro identifier */
  1397. Xunsigned targtype;        /* target declaration type for the macro   */
  1398. X{
  1399. X    /*
  1400. X     *    An Ease macro may be declared as both a singular macro and
  1401. X     *    a class macro.
  1402. X     *
  1403. X     */
  1404. X    if (ISMACRO(pmac->idtype) || ISCLASS(pmac->idtype)) {
  1405. X        pmac->idtype |= targtype;
  1406. X        return (pmac->idval.idc);
  1407. X    }
  1408. X    if (ISTYPED(pmac->idtype)) {    /* not a macro or class id */
  1409. X        PrintError ("Redeclaring or using as macro or class:", pmac->psb);
  1410. X        return ('\0');
  1411. X    }
  1412. X    pmac->idtype |= targtype;    /* previously untyped; declare here */
  1413. X    return (UniqMac (pmac));
  1414. X}
  1415. X    
  1416. X
  1417. X/*
  1418. X *    GetField () -- Returns a field type string given a field 
  1419. X *               identifier (fid).
  1420. X *
  1421. X */
  1422. Xchar *
  1423. XGetField (fid)
  1424. Xregister struct he *fid;    /* field identifier */
  1425. X{
  1426. X    if (!ISFIELD(fid->idtype)) {
  1427. X        PrintError ("Field type not defined for", fid->psb);
  1428. X        return (NULL);
  1429. X    } else 
  1430. X        return (fid->idval.fstring);
  1431. X}
  1432. X
  1433. X
  1434. X/*
  1435. X *    CheckMailer () -- Declares a mailer identifier (mid) as type mailer,
  1436. X *              checking that the identifier was not previously 
  1437. X *              declared a different type. 
  1438. X *
  1439. X */
  1440. Xchar *
  1441. XCheckMailer (mid)
  1442. Xregister struct he *mid;
  1443. X{
  1444. X    if (ISTYPED (mid->idtype) && !ISMAILER (mid->idtype)) {
  1445. X        PrintError ("Redeclaration as mailer:", mid->psb);
  1446. X        return (NULL);
  1447. X    }
  1448. X    mid->idtype |= ID_MAILER;
  1449. X    return (mid->psb);
  1450. X}
  1451. X
  1452. X
  1453. X/*
  1454. X *    AssignType () -- Assigns to each field identifier in fidlist the
  1455. X *             type (in string form) fidtype.  This is accomplished
  1456. X *             by making each field identifier symbol table entry
  1457. X *             "point" to the type found in fidtype.
  1458. X *
  1459. X */
  1460. Xvoid
  1461. XAssignType (fidlist, fidtype)
  1462. Xregister char *fidlist;        /* field identifier list, blank separated */
  1463. Xchar *fidtype;            /* field identifier type string          */
  1464. X{
  1465. X    register struct he *fid;    /* pointer to a field identifier  */
  1466. X    char *fres;            /* field type result string      */
  1467. X    register char *srch;        /* fidlist search pointer      */
  1468. X    char  sep;            /* fidlist separator character    */
  1469. X
  1470. X    fres = (char *) malloc (strlen (fidtype) + 1);
  1471. X    if (fres == NULL)
  1472. X        FatalError ("System out of string space in AssignType ()", (char *) NULL);
  1473. X    strcpy (fres, fidtype);        /* make clean copy of string type */
  1474. X
  1475. X    /*
  1476. X     *    Search for all field identifiers and make the type assignment. 
  1477. X      *
  1478. X     */
  1479. X    srch = fidlist;
  1480. X    while (*srch != '\0') {
  1481. X        while ((*++srch != ' ') && (*srch != '\0'))
  1482. X            /* null */ ;
  1483. X        if (*fidlist != '\0') {                /* found a field id       */
  1484. X            sep = *srch;
  1485. X            *srch = '\0';
  1486. X            fid = LookupSymbol (fidlist);    /* get symbol table entry */
  1487. X            if (ISFIELD(fid->idtype)) {
  1488. X                if (strcmp (fid->idval.fstring, fres))
  1489. X                    PrintWarning ("Redefinition of field type for %s.\n", fid->psb);
  1490. X            } else if (ISTYPED(fid->idtype)) {
  1491. X                PrintError ("Redeclaration of identifier as a field:", fid->psb);
  1492. X                return;
  1493. X            }
  1494. X            fid->idtype |= ID_FIELD;    /* type the identifier    */
  1495. X            fid->idval.fstring = fres;    /* type the field      */
  1496. X            if ((*srch = sep) != '\0')
  1497. X                fidlist = ++srch;
  1498. X        }
  1499. X    }
  1500. X}
  1501. END_OF_FILE
  1502. if test 5664 -ne `wc -c <'src/idman.c'`; then
  1503.     echo shar: \"'src/idman.c'\" unpacked with wrong size!
  1504. fi
  1505. chmod +x 'src/idman.c'
  1506. # end of 'src/idman.c'
  1507. fi
  1508. if test -f 'src/main.c' -a "${1}" != "-c" ; then 
  1509.   echo shar: Will not clobber existing file \"'src/main.c'\"
  1510. else
  1511. echo shar: Extracting \"'src/main.c'\" \(4028 characters\)
  1512. sed "s/^X//" >'src/main.c' <<'END_OF_FILE'
  1513. X/*    $Header: main.c,v 2.0 88/06/15 14:42:41 root Exp $    */
  1514. X
  1515. X/*
  1516. X * $Log:    main.c,v $
  1517. X * Revision 2.0  88/06/15  14:42:41  root
  1518. X * Baseline release for net posting. ADR.
  1519. X * 
  1520. X */
  1521. X
  1522. X/*
  1523. X *      main.c     -- Main procedure for Ease Translator.
  1524. X *
  1525. X *      author     -- James S. Schoner, Purdue University Computing Center
  1526. X *                        West Lafayette, Indiana  47907
  1527. X *
  1528. X *      date       -- July 9, 1985
  1529. X *
  1530. X *    Copyright (c) 1985 by Purdue Research Foundation
  1531. X *
  1532. X *    All rights reserved.
  1533. X *
  1534. X */
  1535. X
  1536. X#include "fixstrings.h"
  1537. X#include <stdio.h>
  1538. X
  1539. Xextern FILE *DIAGf;            /* diagnostic file */
  1540. Xextern void InitError (), 
  1541. X        InitSymbolTable (),
  1542. X        DefScan (),
  1543. X        FatalError (),
  1544. X            PreLoad ();
  1545. X
  1546. Xint ErrorCount;                /* translation error count */
  1547. Xvoid GetArgs ();            /* gets arguments to "et"  */
  1548. X
  1549. X/*
  1550. X *    main () -- Main procedure for the Ease Translator et.  If no files are 
  1551. X *                  given as arguments to et, stdin is translated and written to 
  1552. X *               stdout.  If one file is given, it is translated and written 
  1553. X *               to stdout.  If two files are given, the first is translated
  1554. X *               and written to the second.  If the first filename is "-",
  1555. X *               standard input is assumed.  A translation is performed on 
  1556. X *               valid Ease input only, producing a regular sendmail 
  1557. X *           configuration file. 
  1558. X *
  1559. X */
  1560. Xvoid
  1561. Xmain (argc, argv)
  1562. Xint argc;        /* argument count for "et"  */
  1563. Xchar *argv[];        /* argument vector for "et" */
  1564. X{
  1565. X    InitError ();            /* initialize error conditions */
  1566. X    InitSymbolTable ();        /* initialize the symbol table */
  1567. X    PreLoad ();            /* preload special identifiers */
  1568. X    GetArgs (argc, argv);        /* set up argument files       */
  1569. X    (void) yyparse ();        /* perform translation           */
  1570. X    if (fflush (stdout) == EOF)
  1571. X        FatalError ("Cannot flush output stream/file", (char *) NULL);
  1572. X    DefScan ();                /* warn about undefined idents */
  1573. X    if (ErrorCount)
  1574. X        fprintf (DIAGf, "\n\n*** %d error(s) detected.\n", ErrorCount);
  1575. X    exit (ErrorCount);
  1576. X}
  1577. X
  1578. X
  1579. X/*
  1580. X *    GetArgs () -- Processes arguments to the Ease translator "et".  The
  1581. X *              arguments are files (margv) which may replace either/both
  1582. X *              of the files standard input and standard output.  The 
  1583. X *              following cases are possible:
  1584. X *            
  1585. X *              -- et f.e f.cf
  1586. X *                Translate Ease file f.e and write result
  1587. X *                to f.cf.
  1588. X *
  1589. X *              -- et f.e
  1590. X *                Translate Ease file f.e and write result to
  1591. X *                standard output.
  1592. X *
  1593. X *              -- et - f.cf
  1594. X *                Translate standard input and write result to
  1595. X *                f.cf.
  1596. X *
  1597. X *              -- et
  1598. X *                Translate standard input and write result to
  1599. X *                standard output.
  1600. X *
  1601. X *              Finally, a message indicating the volatility of the 
  1602. X *              Ease output is written.
  1603. X *
  1604. X */
  1605. Xvoid
  1606. XGetArgs (margc, margv)
  1607. Xregister int   margc;        /* argument count  */
  1608. Xregister char *margv[];        /* argument vector */
  1609. X{
  1610. X    switch (margc) {
  1611. X        case 1 : break;
  1612. X        case 2 :
  1613. X        case 3 : if (strcmp (margv[1], "-") && (freopen (margv[1], "r", stdin) == NULL))
  1614. X                FatalError ("Cannot open input stream/file:", margv[1]);
  1615. X             if ((margc == 3) && (freopen (margv[2], "w", stdout) == NULL))
  1616. X                FatalError ("Cannot open output file:", margv[2]);
  1617. X             break;
  1618. X        default: FatalError ("Usage: et [infile [outfile]]", (char *) NULL);
  1619. X             break;
  1620. X    }
  1621. X    printf ("###################################################\n");
  1622. X    printf ("##                                               ##\n");
  1623. X    printf ("##  WARNING: THIS FILE IS THE OUTPUT OF THE      ##\n");
  1624. X    printf ("##           `EASE' PRECOMPILER FOR SENDMAIL     ##\n");
  1625. X    printf ("##           CONFIGURATION FILES.                ##\n");
  1626. X    printf ("##                                               ##\n");
  1627. X    printf ("##           MAKE MODIFICATIONS TO THE SOURCE    ##\n");
  1628. X    printf ("##           FILE ONLY.  CHANGES MADE DIRECTLY   ##\n");
  1629. X    printf ("##           TO THIS FILE WILL DISAPPEAR THE     ##\n");
  1630. X    printf ("##           NEXT TIME THAT EASE IS RUN.         ##\n");
  1631. X    printf ("##                                               ##\n");
  1632. X    printf ("###################################################\n");
  1633. X}
  1634. END_OF_FILE
  1635. if test 4028 -ne `wc -c <'src/main.c'`; then
  1636.     echo shar: \"'src/main.c'\" unpacked with wrong size!
  1637. fi
  1638. chmod +x 'src/main.c'
  1639. # end of 'src/main.c'
  1640. fi
  1641. if test -f 'src/symtab.c' -a "${1}" != "-c" ; then 
  1642.   echo shar: Will not clobber existing file \"'src/symtab.c'\"
  1643. else
  1644. echo shar: Extracting \"'src/symtab.c'\" \(6060 characters\)
  1645. sed "s/^X//" >'src/symtab.c' <<'END_OF_FILE'
  1646. X/*    $Header: symtab.c,v 2.0 88/06/15 14:43:04 root Exp $    */
  1647. X
  1648. X/*
  1649. X * $Log:    symtab.c,v $
  1650. X * Revision 2.0  88/06/15  14:43:04  root
  1651. X * Baseline release for net posting. ADR.
  1652. X * 
  1653. X */
  1654. X
  1655. X/*
  1656. X *      symtab.c   -- Contains Ease Translator symbol table routines.
  1657. X *
  1658. X *      author     -- James S. Schoner, Purdue University Computing Center,
  1659. X *                        West Lafayette, Indiana  47907
  1660. X *
  1661. X *      date       -- July 9, 1985
  1662. X *
  1663. X *    Copyright (c) 1985 by Purdue Research Foundation
  1664. X *
  1665. X *    All rights reserved.
  1666. X *
  1667. X */
  1668. X
  1669. X#include "fixstrings.h"
  1670. X#include <stdio.h>
  1671. X#include <ctype.h>
  1672. X#include "symtab.h"
  1673. X
  1674. X#define ERRORMAILER "error"        /* predefined error mailer name */
  1675. X
  1676. Xextern void FatalError (),
  1677. X        PrintWarning ();
  1678. X
  1679. Xstruct he *LookupSymbol ();
  1680. X
  1681. Xstruct Defmac {                /* predefined macro struct def  */
  1682. X    char *macname;
  1683. X    char  macrep;
  1684. X};
  1685. X
  1686. Xstatic struct he *SymTab[SST];        /* hash table base array        */
  1687. Xstatic struct Defmac MacDefs[] = {    /* predefined macros            */
  1688. X            {"m_smtp",    'e'},
  1689. X            {"m_oname",    'j'},
  1690. X            {"m_ufrom",    'l'},
  1691. X            {"m_daemon",    'n'},
  1692. X            {"m_addrops",    'o'},
  1693. X            {"m_defaddr",    'q'},
  1694. X            {"m_sitename",    'w'},
  1695. X            {"m_odate",    'a'},
  1696. X            {"m_adate",    'b'},
  1697. X            {"m_hops",    'c'},
  1698. X            {"m_udate",    'd'},
  1699. X            {"m_saddr",    'f'},
  1700. X            {"m_sreladdr",    'g'},
  1701. X            {"m_rhost",    'h'},
  1702. X            {"m_qid",    'i'},
  1703. X            {"m_pid",    'p'},
  1704. X            {"m_protocol",    'r'},
  1705. X            {"m_shostname", 's'},
  1706. X            {"m_ctime",    't'},
  1707. X            {"m_ruser",    'u'},
  1708. X            {"m_version",    'v'},
  1709. X            {"m_sname",    'x'},
  1710. X            {"m_stty",    'y'},
  1711. X            {"m_rhdir",    'z'},
  1712. X            {"sentinel",    '\0'}
  1713. X};
  1714. X
  1715. X/* FLUKE jps 28-apr-86 - Install some wired-in class names */
  1716. Xstatic struct Defmac ClassDefs[] = {    /* predefined classes */
  1717. X            {"c_myname",    'w'},
  1718. X            {"class_sentinel",    '\0'}
  1719. X};
  1720. X
  1721. X/*
  1722. X *    DefScan () -- Scan symbol table to find macros, classes, mailers, 
  1723. X *              and rulesets which have been referenced or declared, but
  1724. X *              not defined.  A warning is printed for each such 
  1725. X *              occurence.  This routine is usually called at the end
  1726. X *              of a successful Ease translation.
  1727. X *
  1728. X */
  1729. Xvoid
  1730. XDefScan ()
  1731. X{
  1732. X    register int stindex;        /* symbol table hash index   */
  1733. X    register struct he *hcsearch;    /* hash chain search pointer */
  1734. X
  1735. X    for (stindex = 0; stindex < SST; stindex++) {
  1736. X        if ((hcsearch = SymTab[stindex]) != NULL)
  1737. X            while (hcsearch != NULL) {
  1738. X                if ((ISMACRO(hcsearch->idtype) && 
  1739. X                     isupper(hcsearch->idval.idc)) &&
  1740. X                     !ISMACRO(hcsearch->idd))
  1741. X                    PrintWarning ("Macro not defined: %s\n", hcsearch->psb);
  1742. X#ifdef notdef
  1743. X                if (ISCLASS(hcsearch->idtype) && !ISCLASS(hcsearch->idd))
  1744. X#else
  1745. X                /* FLUKE jps 28-apr-86 */
  1746. X                /* print warnings for UPPER CASE names only */
  1747. X                if (ISCLASS(hcsearch->idtype) &&
  1748. X                    isupper(hcsearch->idval.idc) &&
  1749. X                    !ISCLASS(hcsearch->idd))
  1750. X#endif
  1751. X                    PrintWarning ("Class not defined: %s\n", hcsearch->psb);
  1752. X                if (ISMAILER(hcsearch->idtype) && !ISMAILER(hcsearch->idd))
  1753. X                    PrintWarning ("Mailer not defined: %s\n", hcsearch->psb);
  1754. X                if (ISRULESET(hcsearch->idtype) && !ISRULESET(hcsearch->idd))
  1755. X                    PrintWarning ("Ruleset not defined: %s\n", hcsearch->psb);
  1756. X                hcsearch = hcsearch->phe;
  1757. X            }
  1758. X    }
  1759. X}
  1760. X                     
  1761. X
  1762. X/*
  1763. X *    InitSymbolTable () -- Invoked by main () to initialize the symbol table.
  1764. X *
  1765. X */
  1766. Xvoid
  1767. XInitSymbolTable ()
  1768. X{
  1769. X    int i;
  1770. X
  1771. X    for (i = 0; i < SST; i++)        /* initialize base array */
  1772. X        SymTab[i] = NULL;
  1773. X}
  1774. X
  1775. X
  1776. X/*
  1777. X *    PreLoad () -- Invoked by main () to preload special macro names 
  1778. X *              and mailer declarations.
  1779. X *
  1780. X */
  1781. Xvoid
  1782. XPreLoad ()
  1783. X{
  1784. X    struct Defmac *macptr;
  1785. X    struct he     *symptr;
  1786. X
  1787. X    /* preload special (lower-case) macros */
  1788. X    for (macptr = &MacDefs[0]; (*macptr).macrep != '\0'; macptr++) {
  1789. X        symptr = LookupSymbol ((*macptr).macname);
  1790. X        symptr->idtype |= ID_MACRO;
  1791. X        symptr->idval.idc = (*macptr).macrep;
  1792. X    }
  1793. X
  1794. X    /* preload special (lower-case) classes */
  1795. X    for (macptr = &ClassDefs[0]; (*macptr).macrep != '\0'; macptr++) {
  1796. X        symptr = LookupSymbol ((*macptr).macname);
  1797. X        symptr->idtype |= ID_CLASS;
  1798. X        symptr->idval.idc = (*macptr).macrep;
  1799. X    }
  1800. X
  1801. X    /* preload error mailer declaration */
  1802. X    symptr = LookupSymbol (ERRORMAILER);
  1803. X    symptr->idtype |= ID_MAILER;
  1804. X    symptr->idd |= ID_MAILER;
  1805. X}
  1806. X    
  1807. X
  1808. X/*
  1809. X *    LookupSymbol () -- Returns a pointer to the hash entry already 
  1810. X *               existing, or newly created, which corresponds 
  1811. X *               to string sb.
  1812. X *
  1813. X */
  1814. Xstruct he *
  1815. XLookupSymbol (sb)
  1816. Xchar sb[];            /* string buffer containing identifier */
  1817. X{
  1818. X    struct he *phe;        /* hash entry search pointer  */
  1819. X    int      hc;        /* hash code of sb identifier */
  1820. X    extern char *malloc ();
  1821. X
  1822. X    phe = SymTab[hc = HashCode (sb)];
  1823. X    while (phe != NULL)            /* find hash entry for sb */
  1824. X        if (!strcmp (phe->psb, sb))
  1825. X            return (phe);
  1826. X        else
  1827. X            phe = phe->phe;
  1828. X    /* make new symbol table entry */
  1829. X    if ((phe = (struct he *) malloc (sizeof (struct he))) == NULL)
  1830. X        FatalError ("System out of space in LookupSymbol ()", (char *) NULL);
  1831. X    if ((phe->psb = (char *) malloc (strlen (sb) + 1)) == NULL)
  1832. X        FatalError ("System out of space in LookupSymbol ()", (char *) NULL);
  1833. X    strcpy (phe->psb, sb);
  1834. X    phe->idval.idc = '\0';
  1835. X    phe->idtype = ID_UNTYPED;
  1836. X    phe->idd = ID_UNTYPED;
  1837. X    phe->phe = SymTab[hc];
  1838. X    return (SymTab[hc] = phe);
  1839. X}
  1840. X
  1841. X
  1842. X/*
  1843. X *    RemoveSymbol () -- Removes the symbol table entry phe from the 
  1844. X *               symbol table.
  1845. X *
  1846. X */
  1847. Xvoid
  1848. XRemoveSymbol (phe)
  1849. Xstruct he *phe;       /* pointer to hash entry to be removed from symbol table */
  1850. X{
  1851. X    int hc;               /* hash code of entry phe       */
  1852. X    struct he *sphe;    /* search pointer for entry phe */
  1853. X
  1854. X    if (phe == NULL)
  1855. X        return;
  1856. X    else {            /* search and remove entry phe  */
  1857. X        sphe = SymTab[hc = HashCode (phe->psb)];
  1858. X        free (phe->psb);
  1859. X        if (sphe == phe)
  1860. X            SymTab[hc] = phe->phe;
  1861. X        else
  1862. X            while (sphe != NULL)
  1863. X                if (sphe->phe == phe) {
  1864. X                    sphe->phe = phe->phe;
  1865. X                    return;
  1866. X                } else
  1867. X                    sphe = sphe->phe;
  1868. X    }
  1869. X}
  1870. X
  1871. X
  1872. X/*
  1873. X *    HashCode () -- Returns the hash code of the string in sb by adding 
  1874. X *               the character values and applying mod by the hash 
  1875. X *               table size.
  1876. X *
  1877. X */
  1878. Xint
  1879. XHashCode (sb)
  1880. Xchar sb[];
  1881. X{
  1882. X    int ccSum = 0;            /* sum of char values in string sb */
  1883. X    int i;
  1884. X
  1885. X    for (i = 0; sb[i]; i++)        /* add char codes for sb chars     */
  1886. X        ccSum += sb[i];
  1887. X    return (ccSum % SST);        /* return sum mod table size       */
  1888. X}
  1889. END_OF_FILE
  1890. if test 6060 -ne `wc -c <'src/symtab.c'`; then
  1891.     echo shar: \"'src/symtab.c'\" unpacked with wrong size!
  1892. fi
  1893. chmod +x 'src/symtab.c'
  1894. # end of 'src/symtab.c'
  1895. fi
  1896. if test -f 'src/symtab.h' -a "${1}" != "-c" ; then 
  1897.   echo shar: Will not clobber existing file \"'src/symtab.h'\"
  1898. else
  1899. echo shar: Extracting \"'src/symtab.h'\" \(2471 characters\)
  1900. sed "s/^X//" >'src/symtab.h' <<'END_OF_FILE'
  1901. X/*    $Header: symtab.h,v 2.0 88/06/15 14:43:08 root Exp $    */
  1902. X
  1903. X/*
  1904. X * $Log:    symtab.h,v $
  1905. X * Revision 2.0  88/06/15  14:43:08  root
  1906. X * Baseline release for net posting. ADR.
  1907. X * 
  1908. X */
  1909. X
  1910. X/*
  1911. X *    symtab.h    -- Definitions related to the "et" symbol table. 
  1912. X *
  1913. X *    author        -- James S. Schoner, Purdue University Computing Center,
  1914. X *                     West Lafayette, Indiana  47907
  1915. X *
  1916. X *    date        -- July 1, 1985
  1917. X *
  1918. X *    Copyright (c) 1985 by Purdue Research Foundation
  1919. X *
  1920. X *    All rights reserved.
  1921. X *
  1922. X */
  1923. X
  1924. X#define TRUE      1
  1925. X#define FALSE     0
  1926. X#define SST       101        /* size of hash table (symbol table)          */
  1927. X#define RSNMAX    5        /* size of a ruleset number character buffer */
  1928. X#define VALRSNMAX 9999        /* max value of ruleset number             */
  1929. X
  1930. X
  1931. X/* identifier types */
  1932. X#define ID_UNTYPED 0
  1933. X#define ID_MACRO   01
  1934. X#define ID_CLASS   02
  1935. X#define ID_RULESET 04
  1936. X#define ID_FIELD   010
  1937. X#define ID_PREC       020
  1938. X#define ID_MAILER  040
  1939. X
  1940. X/* identifier type macros */
  1941. X#define ISTYPED(x) (x|ID_UNTYPED)
  1942. X#define ISMACRO(x) (x&ID_MACRO)
  1943. X#define ISCLASS(x) (x&ID_CLASS)
  1944. X#define ISRULESET(x) (x&ID_RULESET)
  1945. X#define ISFIELD(x) (x&ID_FIELD)
  1946. X#define ISPREC(x) (x&ID_PREC)
  1947. X#define ISMAILER(x) (x&ID_MAILER)
  1948. X
  1949. X/* block definition types */
  1950. Xenum bdefs {def_macro, def_class, def_option, def_prec, def_trusted, 
  1951. X        def_header, def_mailer, def_ruleset};
  1952. X
  1953. X/* option types */
  1954. Xenum opts {opt_A, opt_a, opt_B, opt_C, opt_c, opt_D, opt_d, opt_e, opt_F,
  1955. X       opt_f, opt_g, opt_H, opt_i, opt_L, opt_m, opt_N, opt_n, opt_o,
  1956. X       opt_P, opt_Q, opt_q, opt_r, opt_S, opt_s, opt_T, opt_t, opt_u,
  1957. X       opt_v, opt_W, opt_x, opt_X, opt_Y, opt_y, opt_Z, opt_z,
  1958. X       d_opt_i, d_opt_b, d_opt_q,
  1959. X       e_opt_p, e_opt_e, e_opt_m, e_opt_w, e_opt_z};
  1960. X
  1961. X/* flag types */
  1962. Xenum flgs {flg_f, flg_r, flg_S, flg_n, flg_l, flg_s, flg_m, flg_F, flg_D,
  1963. X       flg_M, flg_x, flg_P, flg_u, flg_h, flg_A, flg_U, flg_e, flg_X,
  1964. X       flg_L, flg_p, flg_I, flg_C, flg_E, flg_R};
  1965. X
  1966. X/* mailer parameters */
  1967. Xenum mats {mat_path, mat_flags, mat_sender, mat_recipient, mat_argv, 
  1968. X       mat_eol, mat_maxsize};
  1969. X
  1970. Xstruct he {    /* hash entry structure for symbol table node     */
  1971. X    unsigned   idtype;    /* identifier type         */
  1972. X    unsigned   idd;          /* identifier definition flag     */
  1973. X    char      *psb;        /* identifier string buffer     */
  1974. X    union {
  1975. X        char rsn[RSNMAX];     /* ruleset number             */
  1976. X        int prec;          /* precedence value           */
  1977. X        char idc;        /* one char id representation */
  1978. X        char *fstring;        /* field string               */
  1979. X    } idval;
  1980. X    struct he *phe;        /* next hash entry         */
  1981. X};
  1982. END_OF_FILE
  1983. if test 2471 -ne `wc -c <'src/symtab.h'`; then
  1984.     echo shar: \"'src/symtab.h'\" unpacked with wrong size!
  1985. fi
  1986. chmod +x 'src/symtab.h'
  1987. # end of 'src/symtab.h'
  1988. fi
  1989. echo shar: End of archive 1 \(of 3\).
  1990. cp /dev/null ark1isdone
  1991. MISSING=""
  1992. for I in 1 2 3 ; do
  1993.     if test ! -f ark${I}isdone ; then
  1994.     MISSING="${MISSING} ${I}"
  1995.     fi
  1996. done
  1997. if test "${MISSING}" = "" ; then
  1998.     echo You have unpacked all 3 archives.
  1999.     rm -f ark[1-9]isdone
  2000. else
  2001.     echo You still need to unpack the following archives:
  2002.     echo "        " ${MISSING}
  2003. fi
  2004. ##  End of shell archive.
  2005. exit 0
  2006.